package multithread;

//Java标准库提供的定时器

import java.util.Timer;
import java.util.TimerTask;

public class ThreadDemo11 {
    public static void main(String[] args){
        Timer timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                //时间到了之后要执行的代码
                System.out.println("hello timer");
                timer.cancel();
            }
        },3000);
    }
}


